| Conditions | 2 |
| Total Lines | 31 |
| Code Lines | 23 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | import { |
||
| 29 | |||
| 30 | @Put(':id') |
||
| 31 | @Roles(UserRole.COOPERATOR, UserRole.EMPLOYEE) |
||
| 32 | @ApiOperation({ summary: 'Update contact' }) |
||
| 33 | public async index(@Param() dto: IdDTO, @Body() contactDto: ContactDTO) { |
||
| 34 | try { |
||
| 35 | const { id } = dto; |
||
| 36 | const { |
||
| 37 | firstName, |
||
| 38 | lastName, |
||
| 39 | company, |
||
| 40 | email, |
||
| 41 | phoneNumber, |
||
| 42 | notes |
||
| 43 | } = contactDto; |
||
| 44 | |||
| 45 | await this.commandBus.execute( |
||
| 46 | new UpdateContactCommand( |
||
| 47 | id, |
||
| 48 | firstName, |
||
| 49 | lastName, |
||
| 50 | company, |
||
| 51 | email, |
||
| 52 | phoneNumber, |
||
| 53 | notes |
||
| 54 | ) |
||
| 55 | ); |
||
| 56 | |||
| 57 | return { id }; |
||
| 58 | } catch (e) { |
||
| 59 | throw new BadRequestException(e.message); |
||
| 60 | } |
||
| 63 |